package com.example.tossednfound;

import java.util.ArrayList;
import java.util.Comparator;

public class SearchEntry {
	
	public static ArrayList<Item> searchedItems;
	
	public static ArrayList<Item> searchByItemName(String item){ //String inputted in search bar
		searchedItems = new ArrayList<Item>();
		for (Item i: LoginActivity.ItemList){
			if( item.equals(i.itemName) )
				searchedItems.add(i);
		}
		return searchedItems; //if itemName not found in list, return null
	}
	
	public static ArrayList<Item> searchByCategory(String category){
		searchedItems = new ArrayList<Item>();
		for (Item i: LoginActivity.ItemList){
			if( category.equals(i.category))
				searchedItems.add(i);
		}
		return searchedItems;
	}
	
	public static ArrayList<Item> searchByState(String state){
		searchedItems = new ArrayList<Item>();
		for (Item i: LoginActivity.ItemList){
			if( state.equals(i.state))
				searchedItems.add(i);
		}
		return searchedItems;
	}
	
	public static ArrayList<Item> searchByZipCode(String zipCode){
		searchedItems = new ArrayList<Item>();
		for (Item i: LoginActivity.ItemList){
			if( zipCode.equals(i.zipCode))
				searchedItems.add(i);
		}
		return searchedItems;
	}
	
	public static ArrayList<Item> searchByStreetAddress(String streetAddress){
		searchedItems = new ArrayList<Item>();
		for (Item i: LoginActivity.ItemList){
			if( streetAddress.equals(i.streetAddress))
				searchedItems.add(i);
		}
		return searchedItems;
	}
	
	public static ArrayList<Item> searchByCountry(String country){
		searchedItems = new ArrayList<Item>();
		for (Item i: LoginActivity.ItemList){
			if( country.equals(i.country))
				searchedItems.add(i);
		}
		return searchedItems;
	}
}
